package com.zs.factory;

import com.zs.dao.Computation;
import com.zs.dao.impl.*;

/**
 * @author ZhouShuang
 * @version 17
 * @Title
 * @date 2025/6/10 上午10:59
 */
public class ComputationFactory {

    public static Computation getInstance(String type) {
        return switch (type) {
            case "+" -> new Add();
            case "-" -> new Sub();
            case "*" -> new Multiply();
            case "/" -> new Divide();
            case "%" -> new Mod();
            default -> throw new RuntimeException("无效运算符");
        };
    }
}
